<!--
 * @Date: 2019-12-26 11:44:30
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2020-04-14 18:51:46
 * @describe: -客源信息-状态变更-
 -->
<template>
  <div class="stateUpdate">
    <el-form :model="dataForm" label-width="100px" label-position="left">
      <el-form-item label="客户姓名">
        <el-input v-model="dataForm.customerName" placeholder clearable></el-input>
      </el-form-item>
      <el-form-item label="客户电话1">
        <el-input v-model="dataForm.customerPhone1" clearable></el-input>
      </el-form-item>
      <el-form-item label="客户电话2">
        <el-input v-model="dataForm.customerPhone2" clearable></el-input>
      </el-form-item>
      <el-form-item label="客户电话3">
        <el-input v-model="dataForm.customerPhone3" clearable></el-input>
      </el-form-item>
      <!-- <el-form-item label="委托人姓名">
        <el-input v-model="dataForm.clientName" clearable></el-input>
      </el-form-item>
      <el-form-item label="委托人电话1">
        <el-input v-model="dataForm.clientPhone1" clearable></el-input>
      </el-form-item>
      <el-form-item label="委托人电话2">
        <el-input v-model="dataForm.clientPhone2" clearable></el-input>
      </el-form-item> -->
      <!-- <el-form-item label="客源类型">
                <el-select v-model="dataForm.customerType" style="width:100%">
                    <el-option label="写租" :value="1"></el-option>
                    <el-option label="写买" :value="2"></el-option>
                    <el-option label="住租" :value="3"></el-option>
                    <el-option label="住买" :value="4"></el-option>
                    <el-option label="商租" :value="5"></el-option>
                    <el-option label="商买" :value="6"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="交易类型">
                <ren-select
                    v-model="dataForm.transactionType"
                    dict-type="houseTransactionType"
                    class="FormSelect"
                    style="width:100%"
                ></ren-select>
      </el-form-item>-->
      <el-form-item label="状态">
        <ren-select v-model="dataForm.state" dict-type="customerState" style="width:100%"></ren-select>
      </el-form-item>
      <el-form-item  :disabled="!$hasPermission('customer:customerinfo:customerCore')">
        <el-button
          @click="stateUpdateFun"
          style="width:100%;"
          type="primary"
         :disabled="stateUpdateDisable"        
        >保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  name: "",
  data() {
    return {
      customerId: this.$route.query.ID,
      customerType: this.$route.query.customerType,
      dataForm: {
        clientName: "",
        clientPhone1: "",
        clientPhone2: "",
        customerName: "",
        customerPhone1: "",
        customerPhone2: "",
        customerPhone3: "",
        state: ""
      },
      AxiosUrl: "",
      stateUpdateDisable: false
    };
  },
  props: ["CustomerObj"],
  created() {
    this.dataForm = this.CustomerObj;
  },
  mounted() {},
  methods: {
    //修改核心
    stateUpdateFun() {
       this.stateUpdateDisable=true
       setTimeout(()=>{
           this.stateUpdateDisable=false   //点击一次时隔两秒后才能再次点击
       },2000),
      this.$http
        .put("/customer/customerinfo/customerCore", this.dataForm)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          this.$message({
            message: this.$t("prompt.success"),
            type: "success",
            duration: 500,
            onClose: () => {
              // this.$refs["dataForm"].resetFields();
            }
          });
        })
        .catch(() => {});
    }
  },
  activated() {}
};
</script>
<style scoped>
.stateUpdate {
  width: 500px;
  margin: auto;
}
</style>